/**
 *  站点管理 api
 *  @module api/site
 *  @author coder
 */

// API_HOST
import { API_HOST } from '@/config';

// axios
import axios from '@u/axios';

/**
 * 新增站点
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const addSite = (data) =>
	axios({
		method: 'post',
		data: data,
		url: API_HOST + '/website/add'
	});

/**
 * 更新站点
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const editSite = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/website/edit'
	});

/**
 * 删除站点
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const removeSite = (data) =>
	axios({
		method: 'delete',
		data: data,
		url: API_HOST + '/website/remove'
	});

/**
 * 获取站点分页列表
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const pageSite = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/website/page'
	});

/**
 * 获取站点单条信息详情
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const infoSite = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/website/info'
	});

/**
 * 站点上线
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const showSite = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/website/show'
	});

/**
 * 站点下线
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const closeSite = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/website/close'
	});

/**
 * 站点发布
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const publishSite = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/website/publish'
	});

/**
 * 页面目录查询
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const allCatalog = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/page/catalog/all'
	});

/**
 * 目录新增
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const addCatalog = (data) =>
	axios({
		method: 'post',
		data: data,
		url: API_HOST + '/page/catalog/add'
	});
/**
 * 目录修改
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const editCatalog = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/page/catalog/edit'
	});
/**
 * 目录删除
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const removeCatalog = (data) =>
	axios({
		method: 'delete',
		data: data,
		url: API_HOST + '/page/catalog/remove'
	});
/**
 * 目录详情
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const infoCatalog = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/page/catalog/info'
	});

/**
 * 首页数据
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const publishPage = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/website/publish/page'
	});

/**
 * 页面历史
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const pageHistory = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/page/catalog/history'
	});

/**
 * 页面历史详情
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const pageHistoryInfo = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/page/history/details'
	});

/**
 * 页面/目录导出
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const exportPage = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/page/catalog/export-page'
	});

/**
 * 页面/目录导入
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const importPage = (data) =>
	axios({
		method: 'post',
		data: data,
		url: API_HOST + '/page/catalog/import-page'
	});
